errorcount=0
-if locale -a | grep -q en_US.iso88591 ; then
+if locale -a | grep -q en_US.iso88591 ; then
export LC_ALL=en_US.iso88591
-# test input file name mangling
+echo "Running latin1 file name encoding test"
+filenamebase=test_encoding_file¢
+
+# test input file name mangling with gpsbabel::File
+ echo "testing input file name with gpsbabel::File"
rm -f ${TMPDIR}/test_encoding_file*
- cp ${REFERENCE}/bounds-test.gpx ${TMPDIR}/test_encoding_file¢.gpx
- ${PNAME} -i gpx -f ${TMPDIR}/test_encoding_file¢.gpx -o kml -F ${TMPDIR}/test_encoding_fileo.kml || {
+ cp ${REFERENCE}/bounds-test.gpx ${TMPDIR}/${filenamebase}.gpx
+ ${PNAME} -i gpx -f ${TMPDIR}/${filenamebase}.gpx -o kml -F ${TMPDIR}/test_encoding_fileo.kml || {
echo "ERROR: The input file name was mangled."
errorcount=`expr $errorcount + 1`
}
-# test output file name mangling
+# test output file name mangling with gpsbabel::File
+ echo "testing output file name with gpsbabel::File"
rm -f ${TMPDIR}/test_encoding_file*
- ${PNAME} -i gpx -f ${REFERENCE}/bounds-test.gpx -o kml -F ${TMPDIR}/test_encoding_file¢.kml
- count=$(ls -1 -l ${TMPDIR}/test_encoding_file¢.kml | wc -l)
+ ${PNAME} -i gpx -f ${REFERENCE}/bounds-test.gpx -o kml -F ${TMPDIR}/${filenamebase}.kml
+ count=$(ls -1 -l ${TMPDIR}/${filenamebase}.kml 2>/dev/null | wc -l)
if [ $count -lt 1 ]; then
echo "ERROR: The output file name was mangled."
errorcount=`expr $errorcount + 1`
fi
-# test output file name mangling using a format that uses gbfile
+# test input file name mangling with gbfile stdapi
+ echo "testing input file name with gbfile stdapi"
rm -f ${TMPDIR}/test_encoding_file*
- ${PNAME} -i gpx -f ${REFERENCE}/bounds-test.gpx -o unicsv -F ${TMPDIR}/test_encoding_file¢.csv
- count=$(ls -1 -l ${TMPDIR}/test_encoding_file¢.csv | wc -l)
+ cp ${REFERENCE}/unicsv_subsec.csv ${TMPDIR}/${filenamebase}.csv
+ ${PNAME} -i unicsv -f ${TMPDIR}/${filenamebase}.csv -o kml -F ${TMPDIR}/test_encoding_fileo.kml || {
+ echo "ERROR: The input file name was mangled."
+ errorcount=`expr $errorcount + 1`
+ }
+
+# test output file name mangling with gbfile stdapi
+ echo "testing output file name with gbfile stdapi"
+ rm -f ${TMPDIR}/test_encoding_file*
+ ${PNAME} -i gpx -f ${REFERENCE}/bounds-test.gpx -o unicsv -F ${TMPDIR}/${filenamebase}.csv
+ count=$(ls -1 -l ${TMPDIR}/${filenamebase}.csv 2>/dev/null | wc -l)
if [ $count -lt 1 ]; then
echo "ERROR: The output file name was mangled."
errorcount=`expr $errorcount + 1`
fi
-# test input file name mangling using a format that uses gbfile with the gzapi
+# test input file name mangling with gbfile gzapi
+ echo "testing input file name with gbfile gzapi"
rm -f ${TMPDIR}/test_encoding_file*
- cp ${REFERENCE}/sample.gtm.gz ${TMPDIR}/test_encoding_file¢.gtm.gz
- ${PNAME} -i gtm -f ${TMPDIR}/test_encoding_file¢.gtm.gz -o gpx -F ${TMPDIR}/test_encoding_fileo.gpx || {
+ cp ${REFERENCE}/sample.gtm.gz ${TMPDIR}/${filenamebase}.gtm.gz
+ ${PNAME} -i gtm -f ${TMPDIR}/${filenamebase}.gtm.gz -o kml -F ${TMPDIR}/test_encoding_fileo.kml || {
echo "ERROR: The input file name was mangled."
errorcount=`expr $errorcount + 1`
}
+# test output file name mangling with gbfile gzapi
+ echo "testing output file name with gbfile gzapi"
+ rm -f ${TMPDIR}/test_encoding_file*
+ ${PNAME} -i gpx -f ${REFERENCE}/bounds-test.gpx -o gtm -F ${TMPDIR}/${filenamebase}.gtm.gz
+ count=$(ls -1 -l ${TMPDIR}/${filenamebase}.gtm.gz 2>/dev/null | wc -l)
+ if [ $count -lt 1 ]; then
+ echo "ERROR: The output file name was mangled."
+ errorcount=`expr $errorcount + 1`
+ fi
+
+# TODO: add tests to cover formats that use other open methods.
+# for example shape files.
+
else
echo "$0 cannot run without the en_US.iso88591 locale."
fi